﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Catering_DBOpertion;//Please add references
namespace Catering_Operation
{
	/// <summary>
	/// 数据访问类:Personnel
	/// </summary>
	public partial class D_Personnel
	{
		public D_Personnel()
		{}
        #region  Method
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from Personnel");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
};
            parameters[0].Value = id;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Catering_Model.E_Personnel model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into Personnel(");
            strSql.Append("Name,Sex,Old,[No],Placeoforigin,Education,Professional,Title,Politicalaffiliation,QQ,ServiceUnitID,Tel,Email,[ADD],ClassID,PTID,CID,PID,EatID,IsWorking,back,EntryTime,TrackNum,HealthyNo,EPreventionNo)");
            strSql.Append(" values (");
            strSql.Append("@Name,@Sex,@Old,@No,@Placeoforigin,@Education,@Professional,@Title,@Politicalaffiliation,@QQ,@ServiceUnitID,@Tel,@Email,@ADD,@ClassID,@PTID,@CID,@PID,@EatID,@IsWorking,@back,@EntryTime,@TrackNum,@HealthyNo,@EPreventionNo)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@Name", SqlDbType.VarChar,200),
					new SqlParameter("@Sex", SqlDbType.VarChar,200),
					new SqlParameter("@Old", SqlDbType.DateTime),
					new SqlParameter("@No", SqlDbType.VarChar,200),
					new SqlParameter("@Placeoforigin", SqlDbType.VarChar,200),
					new SqlParameter("@Education", SqlDbType.VarChar,200),
					new SqlParameter("@Professional", SqlDbType.VarChar,200),
					new SqlParameter("@Title", SqlDbType.VarChar,200),
					new SqlParameter("@Politicalaffiliation", SqlDbType.VarChar,200),
					new SqlParameter("@QQ", SqlDbType.VarChar,200),
					new SqlParameter("@ServiceUnitID", SqlDbType.Int,4),
					new SqlParameter("@Tel", SqlDbType.VarChar,200),
					new SqlParameter("@Email", SqlDbType.VarChar,200),
					new SqlParameter("@ADD", SqlDbType.VarChar,200),
					new SqlParameter("@ClassID", SqlDbType.Int,4),
					new SqlParameter("@PTID", SqlDbType.Int,4),
					new SqlParameter("@CID", SqlDbType.Int,4),
					new SqlParameter("@PID", SqlDbType.Int,4),
					new SqlParameter("@EatID", SqlDbType.Int,4),
					new SqlParameter("@IsWorking", SqlDbType.Int,4),
					new SqlParameter("@back", SqlDbType.VarChar,200),
					new SqlParameter("@EntryTime", SqlDbType.DateTime),
					new SqlParameter("@TrackNum", SqlDbType.VarChar,100),
					new SqlParameter("@HealthyNo", SqlDbType.VarChar,100),
					new SqlParameter("@EPreventionNo", SqlDbType.VarChar,100)};
            parameters[0].Value = model.Name;
            parameters[1].Value = model.Sex;
            parameters[2].Value = model.Old;
            parameters[3].Value = model.No;
            parameters[4].Value = model.Placeoforigin;
            parameters[5].Value = model.Education;
            parameters[6].Value = model.Professional;
            parameters[7].Value = model.Title;
            parameters[8].Value = model.Politicalaffiliation;
            parameters[9].Value = model.QQ;
            parameters[10].Value = model.ServiceUnitID;
            parameters[11].Value = model.Tel;
            parameters[12].Value = model.Email;
            parameters[13].Value = model.ADD;
            parameters[14].Value = model.ClassID;
            parameters[15].Value = model.PTID;
            parameters[16].Value = model.CID;
            parameters[17].Value = model.PID;
            parameters[18].Value = model.EatID;
            parameters[19].Value = model.IsWorking;
            parameters[20].Value = model.back;
            parameters[21].Value = model.EntryTime;
            parameters[22].Value = model.TrackNum;
            parameters[23].Value = model.HealthyNo;
            parameters[24].Value = model.EPreventionNo;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Catering_Model.E_Personnel model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update Personnel set ");
            strSql.Append("Name=@Name,");
            strSql.Append("Sex=@Sex,");
            strSql.Append("Old=@Old,");
            strSql.Append("[No]=@No,");
            strSql.Append("Placeoforigin=@Placeoforigin,");
            strSql.Append("Education=@Education,");
            strSql.Append("Professional=@Professional,");
            strSql.Append("Title=@Title,");
            strSql.Append("Politicalaffiliation=@Politicalaffiliation,");
            strSql.Append("QQ=@QQ,");
            strSql.Append("ServiceUnitID=@ServiceUnitID,");
            strSql.Append("Tel=@Tel,");
            strSql.Append("Email=@Email,");
            strSql.Append("[ADD]=@ADD,");
            strSql.Append("ClassID=@ClassID,");
            strSql.Append("PTID=@PTID,");
            strSql.Append("CID=@CID,");
            strSql.Append("PID=@PID,");
            strSql.Append("EatID=@EatID,");
            strSql.Append("IsWorking=@IsWorking,");
            strSql.Append("back=@back,");
            strSql.Append("EntryTime=@EntryTime,");
            strSql.Append("TrackNum=@TrackNum,");
            strSql.Append("HealthyNo=@HealthyNo,");
            strSql.Append("EPreventionNo=@EPreventionNo");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@Name", SqlDbType.VarChar,200),
					new SqlParameter("@Sex", SqlDbType.VarChar,200),
					new SqlParameter("@Old", SqlDbType.DateTime),
					new SqlParameter("@No", SqlDbType.VarChar,200),
					new SqlParameter("@Placeoforigin", SqlDbType.VarChar,200),
					new SqlParameter("@Education", SqlDbType.VarChar,200),
					new SqlParameter("@Professional", SqlDbType.VarChar,200),
					new SqlParameter("@Title", SqlDbType.VarChar,200),
					new SqlParameter("@Politicalaffiliation", SqlDbType.VarChar,200),
					new SqlParameter("@QQ", SqlDbType.VarChar,200),
					new SqlParameter("@ServiceUnitID", SqlDbType.Int,4),
					new SqlParameter("@Tel", SqlDbType.VarChar,200),
					new SqlParameter("@Email", SqlDbType.VarChar,200),
					new SqlParameter("@ADD", SqlDbType.VarChar,200),
					new SqlParameter("@ClassID", SqlDbType.Int,4),
					new SqlParameter("@PTID", SqlDbType.Int,4),
					new SqlParameter("@CID", SqlDbType.Int,4),
					new SqlParameter("@PID", SqlDbType.Int,4),
					new SqlParameter("@EatID", SqlDbType.Int,4),
					new SqlParameter("@IsWorking", SqlDbType.Int,4),
					new SqlParameter("@back", SqlDbType.VarChar,200),
					new SqlParameter("@EntryTime", SqlDbType.DateTime),
					new SqlParameter("@TrackNum", SqlDbType.VarChar,100),
					new SqlParameter("@HealthyNo", SqlDbType.VarChar,100),
					new SqlParameter("@EPreventionNo", SqlDbType.VarChar,100),
					new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = model.Name;
            parameters[1].Value = model.Sex;
            parameters[2].Value = model.Old;
            parameters[3].Value = model.No;
            parameters[4].Value = model.Placeoforigin;
            parameters[5].Value = model.Education;
            parameters[6].Value = model.Professional;
            parameters[7].Value = model.Title;
            parameters[8].Value = model.Politicalaffiliation;
            parameters[9].Value = model.QQ;
            parameters[10].Value = model.ServiceUnitID;
            parameters[11].Value = model.Tel;
            parameters[12].Value = model.Email;
            parameters[13].Value = model.ADD;
            parameters[14].Value = model.ClassID;
            parameters[15].Value = model.PTID;
            parameters[16].Value = model.CID;
            parameters[17].Value = model.PID;
            parameters[18].Value = model.EatID;
            parameters[19].Value = model.IsWorking;
            parameters[20].Value = model.back;
            parameters[21].Value = model.EntryTime;
            parameters[22].Value = model.TrackNum;
            parameters[23].Value = model.HealthyNo;
            parameters[24].Value = model.EPreventionNo;
            parameters[25].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from Personnel ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
};
            parameters[0].Value = id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool DeleteList(string idlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from Personnel ");
            strSql.Append(" where id in (" + idlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Catering_Model.E_Personnel GetModel(int id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,Name,Sex,Old,[No],Placeoforigin,Education,Professional,Title,Politicalaffiliation,QQ,ServiceUnitID,Tel,Email,[ADD],ClassID,PTID,CID,PID,EatID,IsWorking,back,EntryTime,TrackNum,HealthyNo,EPreventionNo from Personnel ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
};
            parameters[0].Value = id;

            Catering_Model.E_Personnel model = new Catering_Model.E_Personnel();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Name"] != null)
                {
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Sex"] != null)
                {
                    model.Sex = ds.Tables[0].Rows[0]["Sex"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Old"].ToString() != "")
                {
                    model.Old = DateTime.Parse(ds.Tables[0].Rows[0]["Old"].ToString());
                }
                if (ds.Tables[0].Rows[0]["No"] != null)
                {
                    model.No = ds.Tables[0].Rows[0]["No"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Placeoforigin"] != null)
                {
                    model.Placeoforigin = ds.Tables[0].Rows[0]["Placeoforigin"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Education"] != null)
                {
                    model.Education = ds.Tables[0].Rows[0]["Education"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Professional"] != null)
                {
                    model.Professional = ds.Tables[0].Rows[0]["Professional"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Title"] != null)
                {
                    model.Title = ds.Tables[0].Rows[0]["Title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Politicalaffiliation"] != null)
                {
                    model.Politicalaffiliation = ds.Tables[0].Rows[0]["Politicalaffiliation"].ToString();
                }
                if (ds.Tables[0].Rows[0]["QQ"] != null)
                {
                    model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ServiceUnitID"].ToString() != "")
                {
                    model.ServiceUnitID = int.Parse(ds.Tables[0].Rows[0]["ServiceUnitID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Tel"] != null)
                {
                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Email"] != null)
                {
                    model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ADD"] != null)
                {
                    model.ADD = ds.Tables[0].Rows[0]["ADD"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ClassID"].ToString() != "")
                {
                    model.ClassID = int.Parse(ds.Tables[0].Rows[0]["ClassID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PTID"].ToString() != "")
                {
                    model.PTID = int.Parse(ds.Tables[0].Rows[0]["PTID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CID"].ToString() != "")
                {
                    model.CID = int.Parse(ds.Tables[0].Rows[0]["CID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PID"].ToString() != "")
                {
                    model.PID = int.Parse(ds.Tables[0].Rows[0]["PID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["EatID"].ToString() != "")
                {
                    model.EatID = int.Parse(ds.Tables[0].Rows[0]["EatID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsWorking"].ToString() != "")
                {
                    model.IsWorking = int.Parse(ds.Tables[0].Rows[0]["IsWorking"].ToString());
                }
                if (ds.Tables[0].Rows[0]["back"] != null)
                {
                    model.back = ds.Tables[0].Rows[0]["back"].ToString();
                }
                if (ds.Tables[0].Rows[0]["EntryTime"].ToString() != "")
                {
                    model.EntryTime = DateTime.Parse(ds.Tables[0].Rows[0]["EntryTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TrackNum"] != null)
                {
                    model.TrackNum = ds.Tables[0].Rows[0]["TrackNum"].ToString();
                }
                if (ds.Tables[0].Rows[0]["HealthyNo"] != null)
                {
                    model.HealthyNo = ds.Tables[0].Rows[0]["HealthyNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["EPreventionNo"] != null)
                {
                    model.EPreventionNo = ds.Tables[0].Rows[0]["EPreventionNo"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,Name,Sex,Old,[No],Placeoforigin,Education,Professional,Title,Politicalaffiliation,QQ,ServiceUnitID,Tel,Email,[ADD],ClassID,PTID,CID,PID,EatID,IsWorking,back,EntryTime,TrackNum,HealthyNo,EPreventionNo ");
            strSql.Append(" FROM Personnel ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" id,Name,Sex,Old,[No],Placeoforigin,Education,Professional,Title,Politicalaffiliation,QQ,ServiceUnitID,Tel,Email,[ADD],ClassID,PTID,CID,PID,EatID,IsWorking,back,EntryTime,TrackNum,HealthyNo,EPreventionNo ");
            strSql.Append(" FROM Personnel ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }
        #endregion  Method


        #region 扩展方法
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Catering_Model.E_Personnel GetModelByWhereClause(string where)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,Name,Sex,Old,No,Placeoforigin,Education,Professional,Title,Politicalaffiliation,QQ,ServiceUnitID,Tel,Email,[ADD],ClassID,PTID,CID,PID,EatID,IsWorking,back,temp1,temp2 from Personnel ");
            strSql.Append(" where 1=1 " + where);

            Catering_Model.E_Personnel model = new Catering_Model.E_Personnel();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Name"] != null && ds.Tables[0].Rows[0]["Name"].ToString() != "")
                {
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Sex"] != null && ds.Tables[0].Rows[0]["Sex"].ToString() != "")
                {
                    model.Sex = ds.Tables[0].Rows[0]["Sex"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Old"] != null && ds.Tables[0].Rows[0]["Old"].ToString() != "")
                {
                    model.Old = DateTime.Parse(ds.Tables[0].Rows[0]["Old"].ToString());
                }
                if (ds.Tables[0].Rows[0]["No"] != null && ds.Tables[0].Rows[0]["No"].ToString() != "")
                {
                    model.No = ds.Tables[0].Rows[0]["No"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Placeoforigin"] != null && ds.Tables[0].Rows[0]["Placeoforigin"].ToString() != "")
                {
                    model.Placeoforigin = ds.Tables[0].Rows[0]["Placeoforigin"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Education"] != null && ds.Tables[0].Rows[0]["Education"].ToString() != "")
                {
                    model.Education = ds.Tables[0].Rows[0]["Education"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Professional"] != null && ds.Tables[0].Rows[0]["Professional"].ToString() != "")
                {
                    model.Professional = ds.Tables[0].Rows[0]["Professional"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Title"] != null && ds.Tables[0].Rows[0]["Title"].ToString() != "")
                {
                    model.Title = ds.Tables[0].Rows[0]["Title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Politicalaffiliation"] != null && ds.Tables[0].Rows[0]["Politicalaffiliation"].ToString() != "")
                {
                    model.Politicalaffiliation = ds.Tables[0].Rows[0]["Politicalaffiliation"].ToString();
                }
                if (ds.Tables[0].Rows[0]["QQ"] != null && ds.Tables[0].Rows[0]["QQ"].ToString() != "")
                {
                    model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ServiceUnitID"] != null && ds.Tables[0].Rows[0]["ServiceUnitID"].ToString() != "")
                {
                    model.ServiceUnitID = Convert.ToInt32(ds.Tables[0].Rows[0]["ServiceUnitID"]);
                }
                if (ds.Tables[0].Rows[0]["Tel"] != null && ds.Tables[0].Rows[0]["Tel"].ToString() != "")
                {
                    model.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Email"] != null && ds.Tables[0].Rows[0]["Email"].ToString() != "")
                {
                    model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ADD"] != null && ds.Tables[0].Rows[0]["ADD"].ToString() != "")
                {
                    model.ADD = ds.Tables[0].Rows[0]["ADD"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ClassID"] != null && ds.Tables[0].Rows[0]["ClassID"].ToString() != "")
                {
                    model.ClassID = int.Parse(ds.Tables[0].Rows[0]["ClassID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PTID"] != null && ds.Tables[0].Rows[0]["PTID"].ToString() != "")
                {
                    model.PTID = int.Parse(ds.Tables[0].Rows[0]["PTID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CID"] != null && ds.Tables[0].Rows[0]["CID"].ToString() != "")
                {
                    model.CID = int.Parse(ds.Tables[0].Rows[0]["CID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PID"] != null && ds.Tables[0].Rows[0]["PID"].ToString() != "")
                {
                    model.PID = int.Parse(ds.Tables[0].Rows[0]["PID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["EatID"] != null && ds.Tables[0].Rows[0]["EatID"].ToString() != "")
                {
                    model.EatID = int.Parse(ds.Tables[0].Rows[0]["EatID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsWorking"] != null && ds.Tables[0].Rows[0]["IsWorking"].ToString() != "")
                {
                    model.IsWorking = int.Parse(ds.Tables[0].Rows[0]["IsWorking"].ToString());
                }
                if (ds.Tables[0].Rows[0]["back"] != null && ds.Tables[0].Rows[0]["back"].ToString() != "")
                {
                    model.back = ds.Tables[0].Rows[0]["back"].ToString();
                }
                if (ds.Tables[0].Rows[0]["EntryTime"].ToString() != "")
                {
                    model.EntryTime = DateTime.Parse(ds.Tables[0].Rows[0]["EntryTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TrackNum"] != null)
                {
                    model.TrackNum = ds.Tables[0].Rows[0]["TrackNum"].ToString();
                }
                if (ds.Tables[0].Rows[0]["HealthyNo"] != null)
                {
                    model.HealthyNo = ds.Tables[0].Rows[0]["HealthyNo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["EPreventionNo"] != null)
                {
                    model.EPreventionNo = ds.Tables[0].Rows[0]["EPreventionNo"].ToString();
                }
                return model;
            }
            else
            {
                return null;
            }
        }

		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "Personnel";
			parameters[1].Value = "id";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;
            return DbHelperSQL.RunProcedure("GetPageData", parameters, "Personnel");
		}

        /// <summary>
        /// 根据条件获取数据总条数
        /// </summary>
        public int GetCountBywhere(string where)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(*) from Personnel ");
            if (where.Length > 0)
            {
                strSql.Append(" where "+where);
            }
            return Convert.ToInt32(DbHelperSQL.GetSingle(strSql.ToString()));
        }

        /// <summary>
        /// 调整班组
        /// </summary>
        public bool SetClassByID(int id, int ClassID)
        {
            string strSql = string.Format("update Personnel set ClassID={0} where id={1}",ClassID,id);
            return DbHelperSQL.ExecuteSql(strSql)>0;
        }
        #endregion

    }
}

